#ifndef __RCMD_MGR__
#define __RCMD_MGR__

#include "msg_result.h"
#include "ParserUtil.h"

class CBTSP;

class CRBINMgr
{
public:
	CRBINMgr();
	~CRBINMgr();
	MSG_RESULT Login(void);
	MSG_RESULT WhoAmI(BYTE HostType, BYTE* pDeviceType);
	MSG_RESULT Initial(CBTSP *pBTSP);
	MSG_RESULT GetNextDataLog(BYTE* pDataLog, int RecordNo, char* DeviceVersion);
	MSG_RESULT StartDownloadDataLog(int StartRecord, int Delay);
	MSG_RESULT StopDownloadDataLog(void);
	MSG_RESULT DownloadACK(void);
	MSG_RESULT SendACK(void);
	MSG_RESULT GetUnitID(char *pUnitID);
	MSG_RESULT SetUnitID(char *pUnitID);
	MSG_RESULT GetDatalogParam(DATALOG_PARAM *pDatalogParam);
	MSG_RESULT SetDatalogParam(DATALOG_PARAM *pDatalogParam);
	MSG_RESULT GetGPSParam(GPS_PARAM *pGpsParam);
	MSG_RESULT SetGPSParam(GPS_PARAM *pGpsParam);
	MSG_RESULT GetPowerMgr(PM_PARAM *pPowerMgr);
	MSG_RESULT SetPowerMgr(PM_PARAM *pPowerMgr);
	MSG_RESULT GetFirmwareVersion(char *pVersion);
	MSG_RESULT GetFlashInfo(FLASH_INFO *pFlashInfo);
	MSG_RESULT CleanDatalog(void);
	MSG_RESULT GetPasswordEnabled(bool *pbEnabled);
	MSG_RESULT SetPasswordEnabled(bool bEnabled);
	MSG_RESULT PasswordVerify(char* pData);
	MSG_RESULT PasswordChange(char* pData);
	MSG_RESULT Logout(void);
	MSG_RESULT SetNavProtocol(BYTE Protocol);
	MSG_RESULT GetNavProtocol(BYTE *pProtocol);
	MSG_RESULT GetBatteryStatus(BYTE *pBatteryStatus);
	MSG_RESULT QueryAllParam(PARAM_PACKAGE *pParamPackage);
	MSG_RESULT FactoryReset(void);
private:
	CBTSP *mBTSP;
	INT32 DownloadDelay;
	MSG_RESULT SendItem(BufferHandle *pBuf, BYTE *pItem, int ItemLen);
};
#endif
